/*
 * Created on 21/ago/07
 *
 * To change the template for this generated file go to
 * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
 */
package it.unibo.deis.lia.mmhc.pas;

//import it.unibo.deis.lia.location.LocationOss;
//import it.unibo.deis.lia.mac.cg.mpe.MobilityEstimator;
import it.unibo.deis.lia.mmhc.rom.*;
import it.unibo.deis.lia.mmhc.util.*;

import java.util.Vector;

// TODO AAA selezione del PATH!!! non del channel...

public class PathSelector {

	private PathMetric topMetric;
	private RoutingManager routingManager;

	public PathSelector(PathMetric topMetric) throws Exception {
		this.topMetric = topMetric;
		this.routingManager = RoutingManager.getInstance();
	}

	public void setMetric(PathMetric newTopMetric) {
		this.topMetric = newTopMetric;
	}

	public Path getBestPath() throws Exception {
		return getBestPath(topMetric);
	}

	public Path getBestPath(PathMetric newPathMetric) throws Exception {
		Vector<Path> suitablePaths = routingManager.getAvailablePaths();

		/*
		 * System.out.println("Currently available paths:"); for(Path path :
		 * suitablePaths){ System.out.println(path); }
		 */

		Path bestPath = newPathMetric.evaluate(suitablePaths);
		return bestPath;
	}
}
